<!DOCTYPE html>
<html lang="en">
<#include "common/head.html">

<body class="fix-header fix-sidebar">

<!-- Preloader - style you can find in spinners.css -->
<div class="preloader">
    <svg class="circular" viewBox="25 25 50 50">
        <circle class="path" cx="50" cy="50" r="20" fill="none"
                stroke-width="2" stroke-miterlimit="10"/>
    </svg>
</div>
<!-- Main wrapper  -->
<div id="main-wrapper">
    <!-- header header  -->
    <#include "common/header.html">
    <!-- End header header -->
    <!-- Left Sidebar  -->
    <#include "common/nav.html">
    <!-- End Left Sidebar  -->
    <!-- Page wrapper  -->
    <div class="page-wrapper">
        <!-- 锐高软件 -->
        <#include "/common/ruigao.html">

        <!--
                    作者：offline
                    时间：2018-03-26
                    描述：查看公司列表
                -->
        <div class="container-fluid">
            <!-- Start Page Content -->
            <div class="row justify-content-center">
                <div class="col-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="card-content">
                                <!-- Left sidebar -->
                                <div class="inbox-leftbar">
                                    <a class="btn btn-danger btn-block waves-effect waves-light"
                                       href="">
                                        <font style="vertical-align: inherit;">
                                            <font style="vertical-align: inherit;">创办公司</font>
                                        </font>
                                    </a>
                                </div>
                            </div>
                            <!-- End Left sidebar -->
                            <div>
                                <div role="toolbar" class="">
                                    <div class="btn-group">
                                        <button class="btn btn-light waves-effect" type="button">
                                            <i class="mdi mdi-archive font-18 vertical-middle"></i>
                                        </button>
                                        <button class="btn btn-light waves-effect" type="button">
                                            <i class="mdi mdi-alert-octagon font-18 vertical-middle"></i>
                                        </button>
                                        <button class="btn btn-light waves-effect" type="button">
                                            <i class="mdi mdi-delete-variant font-18 vertical-middle"></i>
                                        </button>
                                    </div>
                                </div>
                                <div class="mt-4">
                                    <br/>
                                    <table class="table">
                                        <thead>
                                        <tr>
                                            <th>面额</th>
                                            <th>类型</th>
                                            <th>有效期</th>
                                            <th>来源</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <#list page.pageList as item>
                                        <tr>
                                            <#if (page.pageList)??>
                                            <#if (item.vouchersPrice)??>
                                            <td>${item.vouchersPrice}</td>
                                        </
                                        #if>

                                        <#if (item.vouchersType)??>
                                        <#list type as typeitem>
                                        <#if item.vouchersType==typeitem.typeTypeid>
                                        <td>${typeitem.typeTypevalue}</td>
                                        </
                                        #if>
                                    </
                                    #list>
                                </
                                #if>

                                <#if (item.vouchersVal)??>
                                <td>${item.vouchersVal?date}</td>
                            </
                            #if>

                            <#if (item.vouchersSource)??>
                            <td>${item.vouchersSource}</td>
                        </
                        #if>
                        <td>
                            <button type="button" class="btn btn-success btn-sm btn-rounded m-b-2 m-l-5 " id="update">
                                <a href="toupdatevouchers?vouchersId=${item.vouchersId}" style="color: #DEE2E6">编辑</a>
                            </button>
                            <button type="button" class="btn btn-danger btn-sm btn-rounded m-b-2 m-l-5 del " name="del">
                                <a vouchersId="${item.vouchersId}" class='voucherDel' style='color: white;'>删除</a>
                            </button>
                        </td>
                    </
                    #if>
                    </tr>
                </
                #list>
                </tbody>
                </table>
                <div class="table-responsive m-t-40">
                    <div id="example23_wrapper" class="dataTables_wrapper">
                        <div class="dataTables_paginate paging_simple_numbers"
                             id="example23_paginate">

                            <a href="tovoucherslist?form=1"
                               class="paginate_button" aria-controls="example23"
                               data-dt-idx="7" tabindex="0" id="example23"> <font
                                    style="vertical-align: inherit;"> <font
                                    style="vertical-align: inherit;"></font>首页
                            </font>
                            </a>

                            <#if page.getHasPrevPage() == true>
                            <a href="tovoucherslist?form=${page.prevPage}" class="paginate_button previous disabled"
                               aria-controls="example23" data-dt-idx="0" tabindex="0"
                               id="example23_previous"><font
                                    style="vertical-align: inherit;"><font
                                    style="vertical-align: inherit;">上一页</font></font></a>
                        </
                        #if>

                        <#if page.getHasNextPage() == true>
                        <a href="tovoucherslist?form=${page.nextPage}"
                           class="paginate_button next" aria-controls="example23"
                           data-dt-idx="7" tabindex="0" id="example23_next"><font
                                style="vertical-align: inherit;"><font
                                style="vertical-align: inherit;">下一页</font></font></a>
                    </
                    #if>

                    <a href="tovoucherslist?form=${page.totalPage}"
                       class="paginate_button" aria-controls="example23"
                       data-dt-idx="7" tabindex="0" id="example23"> <font
                            style="vertical-align: inherit;"> <font
                            style="vertical-align: inherit;"></font>末页
                    </font>
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Container fluid  -->
<!-- footer -->
<#include "common/footer.html">
<!-- End footer -->
<!-- End Page wrapper  -->
<#include "common/js.html">
<!--
        作者：offline
        时间：2018-04-09
        描述：点击删除按钮弹窗
    -->

<script type="text/javascript">
    $(".voucherDel").click(function () {

        var vouchersId = parseInt($(this).attr("vouchersId"));
        swal(
            {
                title: "您确定要删除该红包吗？",
                animation: "slide-from-top",
                showCancelButton: true,
                closeOnConfirm: false,
                cancelButtonText: "取消",
                confirmButtonText: "确定"

            },
            function (inputValue) {
                if (inputValue === false)
                    return false;
                $.ajax({
                    url: "dodelvouchers",
                    type: "GET",
                    data: {
                        "vouchersId": vouchersId
                    },
                    datatype: "JSON",
                    success: function (
                        data) {
                        if (data) {
                            swal(
                                {
                                    title: "操作成功,<span style='color:red'>已删除</span>红包",
                                    html: true,
                                    type: "success",
                                    showCancelButton: false,
                                    showConfirmButton: true,
                                    confirmButtonText: "确定",
                                },
                                function () {
                                    location.href = "tovoucherslist";
                                });
                        } else {
                            swal({
                                title: '删除失败！',
                                type: 'error',
                                confirmButtonText: '确定',
                                closeOnConfirm: false
                            });
                        }
                    },
                    error: function (
                        data) {
                        swal({
                            title: '操作失败！',
                            type: 'error',
                            confirmButtonText: '确定',
                            closeOnConfirm: false
                        });
                    }

                });
            });

    });
</script>
</body>

</html>